<layout name='Layout/layout_page' />

<script type="text/javascript">
	$(document).ready(function(){
		$('.nav li a').click(function(){
			$("#style").val($(this).attr('type'));
		})
	})
</script>
	
	<ol class="breadcrumb">
		<li><a href="<{:U('Ad/index')}>">运营管理</a></li>
      	<li><a href="<{:U('Ad/index')}>"></a>广告管理</li>
      	<li class="active"><{:L(_public_edit)}></li>
    </ol>


	<form id="ajaxForm" action="<{:U('Ad/update')}>" method="post" class="form-horizontal form-validata">
		<div class="form-group">
			<label class="col-md-1 control-label" for="name">Name：</label>
			<div class="col-md-11">
				<input type="text"
                class="form-control"
				name="name"
				id="name"
				data-rule-required="true"
				value="<{$list['name']}>"
				/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label" for="name">分类：</label>
			<div class="col-md-11">
				<select name="adtype" id="adtype" data-rule-required="true" class="form-control">
					<option value="">==请选择==</option>
					<volist name="adtype" id="vo">
					<option value="<{$vo.id}>"><{$vo.name}></option>
					</volist>
				</select>
			</div>
		</div>

		<div class="form-group">
			<label class="col-md-1 control-label" for="name">广告内容：</label>
			<div class="col-md-11">
				<ul class="nav nav-tabs">
				  <li <php>if($list['style']==='1')echo 'class="active"';</php>><a href="#tab1" data-toggle="tab" type="1">图片</a></li>
				  <li <php>if($list['style']==='2')echo 'class="active"';</php>><a href="#tab2" data-toggle="tab" type="2">flash</a></li>
				  <li <php>if($list['style']==='3')echo 'class="active"';</php>><a href="#tab3" data-toggle="tab" type="3">文字</a></li>
				  <li <php>if($list['style']==='4')echo 'class="active"';</php>><a href="#tab4" data-toggle="tab" type="4">代码</a></li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane <php>if($list['style']==='1')echo active;</php>" id="tab1">

						<p></p>
						<div class="form-group">
							<label class="col-md-1 control-label" for="name">图片地址</label>
							<div class="col-md-5">
								<input type="text" name="imageUrl" id="imageUrl" value="<{$list['imageUrl']}>" class="form-control"/>
							</div>
							<div class="col-md-2">
								<input type="button" value="上传" class="btn btn-info btn-sm" onclick="uploadImage( '<{:U('Admin/Upload/singleImage')}>' , 'imageUrl')"/>
								<a href="<{$list['imageUrl']}>" class="btn btn-default btn-sm" target="_blank">查看</a>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">链接地址</label>
							<div class="col-md-5">
								<input type="text" name="imageLink" value="<{$list['imageLink']}>" data-rule-url="true" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">图片宽度</label>
							<div class="col-md-5">
								<input type="text" name="imageWidth" value="<{$list['imageWidth']}>" data-rule-number="true" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">图片高度</label>
							<div class="col-md-5">
								<input type="text" name="imageHeight" value="<{$list['imageHeight']}>" data-rule-number="true" class="form-control"/>
							</div>
						</div>
					</div>

					<div class="tab-pane <php>if($list['style']==='2')echo active;</php>" id="tab2">
						<p></p>
						<div class="form-group">
							<label class="col-md-1 control-label" for="name">flash地址</label>
							<div class="col-md-5">
								<input type="text" name="flashUrl" id="flashUrl" value="<{$list['flashUrl']}>" class="form-control"/>
							</div>
							<div class="col-md-2">
								<input type="button" value="上传" class="btn btn-info btn-sm" onclick="uploadImage( '<{:U('Admin/Upload/singleImage')}>' , 'flashUrl')"/>
								<a href="<{$list['flashUrl']}>" class="btn btn-default btn-sm" target="_blank">查看</a>
							</div>
						</div>	

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">flash宽度</label>
							<div class="col-md-5">
								<input type="text" name="flashWidth" data-rule-number="true" value="<{$list['flashWidth']}>" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">flash高度</label>
							<div class="col-md-5">
								<input type="text" name="flashHeight" data-rule-number="true" value="<{$list['flashHeight']}>" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="tab-pane <php>if($list['style']==='3')echo active;</php>" id="tab3">
						<p></p>
						<div class="form-group">
							<label class="col-md-1 control-label" for="name">文字内容</label>
							<div class="col-md-5">
								<input type="text" name="text" id="text" value="<{$list['text']}>" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">文字链接</label>
							<div class="col-md-5">
								<input type="text" name="link" value="<{$list['link']}>" data-rule-url="true" class="form-control"/>
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">文字颜色</label>
							<div class="col-md-5">
								<input type="text" name="color" value="<{$list['color']}>" class="form-control"/> 如：#ff0000,red
							</div>
						</div>

						<div class="form-group">
							<label class="col-md-1 control-label" for="name">文字大小</label>
							<div class="col-md-5">
								<input type="text" name="size" value="<{$list['size']}>" class="form-control"/> 如：12px、14px等
							</div>
						</div>		
					</div>
					<div class="tab-pane <php>if($list['style']==='4')echo active;</php>" id="tab4">
						<p></p>
						<textarea name="htmlcode" id="" class="form-control areatext"></textarea> 支持html代码
					</div>
				</div>
			</div>			
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label" for="sort">Sort：</label>
			<div class="col-md-2">
				<input type="text"
                class="form-control"
				name="sort"
				id="sort"
				data-rule-required="true"
				data-rule-number="true"
				value = "<{$list['sort']}>"
				/>
				<p>数字越小越靠前</p>
			</div>
		</div>
		<div class="form-group">
			<div class="col-md-11 col-sm-offset-1">
				<button type="submit" class="btn btn-info"><{:L(_public_edit)}></button>
			</div>
		</div>
		<input type="hidden" name="style" id="style" value="<{$list['style']}>" />
		<input type="hidden" name="id" value="<{$list['id']}>" />
	</form>
</div>

<script type="text/javascript">
$("#adtype").val("<{$list['adtype']}>");
</script>

<input type="hidden" id="menu_action" value="ad" />